package com.crm.jpaandthymeleaf.service.impl;

import com.crm.jpaandthymeleaf.entity.SysRight;
import com.crm.jpaandthymeleaf.entity.SysRole;
import com.crm.jpaandthymeleaf.repository.SysRightRepository;
import com.crm.jpaandthymeleaf.service.ISysRightService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author 周敬
 * @version 1.0
 * @packageName com.crm.jpaandthymeleaf.service.impl
 * @fileName ISysRightServiceImpl
 * @createTime 2021/12/27-19:30-星期一
 * @lastModify 2021/12/27-19:30-星期一
 */
@Service
public class ISysRightServiceImpl implements ISysRightService {

    @Resource
    private SysRightRepository sysRightRepository;

    @Override
    public List<SysRight> findRightAll() {
        return sysRightRepository.findAll();
    }

    @Override
    public List<SysRight> findSysRightByRole(SysRole sysRole) {
        return sysRightRepository.findSysRightsByRolesOrderByRightCode(sysRole);
    }
}
